﻿
function UnitTest-New-TestResult-DoesNotReturnNull {
    [Cmdletbinding()]
    Param()

    # arrange

    # act
    $actual = New-TestResult -Name "Test" -State Passed -Message "UnitTest"

    # assert
    Assert-IsNotNull -Actual $actual -Message "New-TestResult returned NULL"
}

function UnitTest-New-TestResult-UsesCorrectValues {
    [Cmdletbinding()]
    Param()

    # arrange

    # act
    $actual = New-TestResult -Name "Test" -State NotRun -Message "UnitTest"

    # assert
    Assert-AreEqual -Expected "Test" -Actual $actual.Name -Message "New-TestResult used incorrect value for Name"
    Assert-AreEqual -Expected NotRun -Actual $actual.State -Message "New-TestResult used incorrect value for State"
    Assert-AreEqual -Expected "UnitTest" -Actual $actual.Message -Message "New-TestResult used incorrect value for Message"
}

function UnitTest-Group-TestResult-DoesntReturnNull {
    [Cmdletbinding()]
    Param()

    # arrange
    $result = New-TestResult -Name "UnitTest" -State Passed

    # act
    $actual = $result | Group-TestResult -Name "Test" -Force

    # assert
    Assert-IsNotNull -Actual $actual -Message "Group-TestResultSet returned NULL"
    Assert-AreEqual -Expected "Test" -Actual $actual.PSParentPath -Message "Group-TestResult used incorrect value for PSParentPath"
}
